home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / vbeyes10 / eyes.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-08  |  6.0 KB  |  194 lines

  1. VERSION 2.00
  2. Begin Form eyes 
  3.    BackColor       =   &H00FFFFFF&
  4.    BorderStyle     =   0  'None
  5.    Caption         =   "Eyes"
  6.    ClientHeight    =   2610
  7.    ClientLeft      =   1530
  8.    ClientTop       =   1560
  9.    ClientWidth     =   2760
  10.    ClipControls    =   0   'False
  11.    ControlBox      =   0   'False
  12.    DrawStyle       =   5  'Transparent
  13.    Height          =   3015
  14.    Icon            =   EYES.FRX:0000
  15.    Left            =   1470
  16.    LinkTopic       =   "Form1"
  17.    MaxButton       =   0   'False
  18.    MinButton       =   0   'False
  19.    ScaleHeight     =   174
  20.    ScaleMode       =   3  'Pixel
  21.    ScaleWidth      =   184
  22.    Top             =   1215
  23.    Width           =   2880
  24.    WindowState     =   1  'Minimized
  25.    Begin PictureBox Picture9 
  26.       AutoSize        =   -1  'True
  27.       Height          =   510
  28.       Left            =   1920
  29.       Picture         =   EYES.FRX:0302
  30.       ScaleHeight     =   480
  31.       ScaleWidth      =   480
  32.       TabIndex        =   8
  33.       Top             =   1800
  34.       Width           =   510
  35.    End
  36.    Begin PictureBox Picture8 
  37.       AutoSize        =   -1  'True
  38.       Height          =   510
  39.       Left            =   1080
  40.       Picture         =   EYES.FRX:0604
  41.       ScaleHeight     =   480
  42.       ScaleWidth      =   480
  43.       TabIndex        =   7
  44.       Top             =   1800
  45.       Width           =   510
  46.    End
  47.    Begin PictureBox Picture7 
  48.       AutoSize        =   -1  'True
  49.       Height          =   510
  50.       Left            =   240
  51.       Picture         =   EYES.FRX:0906
  52.       ScaleHeight     =   480
  53.       ScaleWidth      =   480
  54.       TabIndex        =   6
  55.       Top             =   1800
  56.       Width           =   510
  57.    End
  58.    Begin PictureBox Picture6 
  59.       AutoSize        =   -1  'True
  60.       Height          =   510
  61.       Left            =   1920
  62.       Picture         =   EYES.FRX:0C08
  63.       ScaleHeight     =   480
  64.       ScaleWidth      =   480
  65.       TabIndex        =   5
  66.       Top             =   1080
  67.       Width           =   510
  68.    End
  69.    Begin PictureBox Picture5 
  70.       AutoSize        =   -1  'True
  71.       Height          =   510
  72.       Left            =   1080
  73.       Picture         =   EYES.FRX:0F0A
  74.       ScaleHeight     =   480
  75.       ScaleWidth      =   480
  76.       TabIndex        =   4
  77.       Top             =   1080
  78.       Width           =   510
  79.    End
  80.    Begin PictureBox Picture4 
  81.       AutoSize        =   -1  'True
  82.       Height          =   510
  83.       Left            =   240
  84.       Picture         =   EYES.FRX:120C
  85.       ScaleHeight     =   480
  86.       ScaleWidth      =   480
  87.       TabIndex        =   3
  88.       Top             =   1080
  89.       Width           =   510
  90.    End
  91.    Begin PictureBox Picture3 
  92.       AutoSize        =   -1  'True
  93.       Height          =   510
  94.       Left            =   1920
  95.       Picture         =   EYES.FRX:150E
  96.       ScaleHeight     =   480
  97.       ScaleWidth      =   480
  98.       TabIndex        =   2
  99.       Top             =   360
  100.       Width           =   510
  101.    End
  102.    Begin PictureBox Picture2 
  103.       AutoSize        =   -1  'True
  104.       Height          =   510
  105.       Left            =   1080
  106.       Picture         =   EYES.FRX:1810
  107.       ScaleHeight     =   480
  108.       ScaleWidth      =   480
  109.       TabIndex        =   1
  110.       Top             =   360
  111.       Width           =   510
  112.    End
  113.    Begin PictureBox Picture1 
  114.       AutoSize        =   -1  'True
  115.       Height          =   510
  116.       Left            =   240
  117.       Picture         =   EYES.FRX:1B12
  118.       ScaleHeight     =   480
  119.       ScaleWidth      =   480
  120.       TabIndex        =   0
  121.       Top             =   360
  122.       Width           =   510
  123.    End
  124. ' Global Variable Used to Determine Cursor Position's Sector
  125. Dim Sector As Integer
  126. Sub Form_Load ()
  127.     'Hide the Normal Form Off the Screen Boundaries
  128.     Eyes.Move -(Eyes.Width + 5), -(Eyes.Height + 5)
  129. End Sub
  130. Sub Form_Resize ()
  131.     'Declare Cursor Structure & OldSector
  132.     Dim Cursor As lpoint
  133.     Dim OldSector As Integer
  134.     ' Quit Program if Not Iconic
  135.     If Eyes.WindowState <> 1 Then End
  136.     ' If Iconic State
  137.     Do While Eyes.WindowState = 1
  138.         'Get the Current Cursor Position
  139.         Call GetCursorPos(Cursor)
  140.         'Save the Last Sector Number
  141.         OldSector = Sector
  142.         'Determine the New Sector Number
  143.         Call GetSector(Cursor.x, Cursor.y)
  144.         ' Skip Icon Paint if Same Sector as Before
  145.         If OldSector = Sector Then GoTo Skipit
  146.         ' Update Icon with New Sector Picture
  147.         Select Case Sector
  148.             Case 1
  149.                 Eyes.Icon = Picture1.Picture
  150.             Case 2
  151.                 Eyes.Icon = Picture2.Picture
  152.             Case 3
  153.                 Eyes.Icon = Picture3.Picture
  154.             Case 4
  155.                 Eyes.Icon = Picture4.Picture
  156.             Case 5
  157.                 Eyes.Icon = Picture5.Picture
  158.             Case 6
  159.                 Eyes.Icon = Picture6.Picture
  160.             Case 7
  161.                 Eyes.Icon = Picture7.Picture
  162.             Case 8
  163.                 Eyes.Icon = Picture8.Picture
  164.             Case 9
  165.                 Eyes.Icon = Picture9.Picture
  166.             End Select
  167. Skipit:
  168.         'Return Processing Back to Windows
  169.         Tmp = DoEvents()
  170.     Loop
  171. End Sub
  172. '   This Subroutine determines the sector number associated with the cursor position
  173. '   There are 9 possible sectors, number 5 being the icon itself
  174. '   +----+----+----+
  175. '   | 01 | 02 | 03 |
  176. '   +----+----+----+
  177. '   | 04 |icon| 06 |
  178. '   +----+----+----+
  179. '   | 07 | 08 | 09 |
  180. '   +----+----+----+
  181. Sub GetSector (x As Integer, y As Integer)
  182.     ' Declare Icon Structure
  183.     Dim Irect As lrect
  184.     'Find Size of Icon
  185.     Call GetWindowRect(Eyes.hWnd, Irect)
  186.     'Find X Sector
  187.     Sector = 1
  188.     If (x >= Irect.Left) And (x < Irect.Right) Then Sector = 2
  189.     If x >= Irect.Right Then Sector = 3
  190.     'Find Y Sector
  191.     If (y >= Irect.Top) And (y < Irect.Bottom) Then Sector = Sector + 3
  192.     If y >= Irect.Bottom Then Sector = Sector + 6
  193. End Sub
  194.